import request from '@/utils/request'

export const addComment = data => {
  return request.post(`/comments`, data)
}

export const deleteComment = id => {
  return request.delete(`/comments/${id}`)
}

export const taskComment = taskid => {
  return request.get(`/comments/${taskid}`)
}

export const taskAddReplyComment = data => {
  return request.post(`/comments/reply`, data)
}

export const getReplyComment = (taskId, parentCommentId) => {
  return request.get(`/comments/reply/${taskId}/${parentCommentId}`)
}

export const addLike = (commentId, username) => {
  return request.post(`/likes/${commentId}/${username}`)
}

export const countLikes = taskid => {
  return request.get(`/likes/${taskid}`)
}

export const isLike = (commentid, username) => {
  return request.get(`/likes/${commentid}/${username}/islike`)
}

export const isTop = commentid => {
  return request.get(`/comments/top/${commentid}`)
}

export const toChangeTop = commentid => {
  return request.patch(`/comments/top/${commentid}`)
}

export const allChat = commentId => {
  return request.get(`/comments/allRelatedComments/${commentId}`)
}
